<?php if (!defined('THINK_PATH')) exit();?><link rel="stylesheet" href="/Public/bootstrap/css/bootstrap.min.css">
	<link href="/Public/bootstrap/css/bootstrap.datepicker/bootstrap-datepicker3.min.css" rel="stylesheet" />
	<script src="/Public/bootstrap/js/jquery.min.js"></script>
	<script src="/Public/bootstrap/js/bootstrap/bootstrap.min.js"></script>
	 <script src="/Public/bootstrap/js/bootstrap.datepicker/js/bootstrap-datepicker.min.js"></script>
    <script src="/Public/bootstrap/js/bootstrap.datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
    <style type="text/css">
		#form-group{
			padding: 5px 0;
		}
    </style>
    <script type="text/javascript">
    $(function () {
        $(".datepicker").datepicker({
            language: "zh-CN",
            autoclose: true,//选中之后自动隐藏日期选择框
            clearBtn: true,//清除按钮
            todayBtn: true,//今日按钮
            format: "yyyy-mm-dd"//日期格式，详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
        });
    });
</script> 
<div style="margin: 10px">
<button class="btn btn-primary"  href="<?php echo U('Depart/Prod/add_prod');?>" data-toggle="modal" data-target="#myModal">新增</button> 
<a class="btn btn-default"  href="<?php echo U('Depart/Prod/prodinfo',array('type'=>2));?>">低温储罐</a>
<a class="btn btn-info"  href="<?php echo U('Depart/Prod/prodinfo',array('type'=>5,'start'=>1));?>">气瓶</a>
<div class="modal fade" id="myModal" tabindex="1">
	<div class="modal-dialog" >
		<div class="modal-content">
		</div>
	</div>
</div>
<table class="table  table-bordered  table-hover">
	<caption style="text-align: center">产品清单一览表</caption>
	<thead style="text-align: center">
		<tr>
			<th>产品令号</th>
			<th>产品名称</th>
			<th>型号规格</th>
			<th>计始</th>
			<th>计完</th>
			<th>开工</th>
			<th>气压</th>
			<th>抽真空</th>
			<th>入库</th>
			<th>审查</th>
			<th>证书</th>
			<!-- <th>设计人</th> -->
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		<?php if(is_array($prod)): foreach($prod as $key=>$v): ?><tr>
				<td><?php echo ($v['prodbatch']); ?></td>
				<?php if(empty($v['spec'])): ?><td colspan="2">
					<a href="javascript:;" id="<?php echo ($v['id']); ?>" prodbatch="<?php echo ($v['prodbatch']); ?>" type="<?php echo ($v['type']); ?>" onclick="edit(this)">选图号</a>
				</td>
				<?php else: ?>
				<td><?php echo ($v['prodname']); ?></td>
				<td><?php echo ($v['spec']); ?></td><?php endif; ?>
				<?php if(empty($v['planstart'])): ?><td><a href="javascript:;" id="<?php echo ($v['id']); ?>" prodbatch="<?php echo ($v['prodbatch']); ?>" item="planstart" onclick="plan(this)">计划开工</a></td>
				<?php else: ?>
				<td><?php echo (date('m.d',$v['planstart'])); ?></td><?php endif; ?>
				</empty>
				<?php if(empty($v['planend'])): ?><td><a href="javascript:;" id="<?php echo ($v['id']); ?>" prodbatch="<?php echo ($v['prodbatch']); ?>" item="planend" onclick="plan(this)">计划完工</a></td>
				<?php else: ?>
				<td><?php echo (date('m.d',$v['planend'])); ?></td><?php endif; ?>
				<?php if(empty($v['start'])): ?><td><a href="<?php echo U('Depart/Prod/checkdate',array('id'=>$v['id'],'item'=>'start'));?>">确认</a></td>
				<?php else: ?>
				<td><?php echo (date('m.d',$v['start'])); ?></td><?php endif; ?>
				<?php if(empty($v['pressure'])): ?><td><a href="<?php echo U('Depart/Prod/checkdate',array('id'=>$v['id'],'item'=>'pressure'));?>">确认</a></td>
				<?php else: ?>
				<td><?php echo (date('m.d',$v['pressure'])); ?></td><?php endif; ?>
				<?php if(empty($v['vacuum'])): ?><td><a href="<?php echo U('Depart/Prod/checkdate',array('id'=>$v['id'],'item'=>'vacuum'));?>">确认</a></td>
				<?php else: ?>
				<td><?php echo (date('m.d',$v['vacuum'])); ?></td><?php endif; ?>
				<?php if(empty($v['end'])): ?><td><a href="<?php echo U('Depart/Prod/checkdate',array('id'=>$v['id'],'item'=>'end'));?>">确认</a></td>
				<?php else: ?>
				<td><?php echo (date('m.d',$v['end'])); ?></td><?php endif; ?>
				<?php if(empty($v['inspect'])): ?><td><a href="<?php echo U('Depart/Prod/checkdate',array('id'=>$v['id'],'item'=>'inspect'));?>">确认</a></td>
				<?php else: ?>
				<td><?php echo (date('m.d',$v['inspect'])); ?></td><?php endif; ?>
				<?php if(empty($v['report'])): ?><td><a href="<?php echo U('Depart/Prod/checkdate',array('id'=>$v['id'],'item'=>'report'));?>">确认</a></td>
				<?php else: ?>
				<td><?php echo (date('m.d',$v['report'])); ?></td><?php endif; ?>
				<!-- <td><?php echo ($v['dname']); ?></td> -->
				<td>
					<!-- <a href="javascript:;" id="<?php echo ($v['id']); ?>" prodbatch="<?php echo ($v['prodbatch']); ?>" planstart="<?php echo ($v['planstart']); ?>" planend="<?php echo ($v['planend']); ?>" onclick="plan(this)">确认计划</a> --> <!-- |
					<a href="javascript:if(confirm('确定删除？'))location='<?php echo U('Depart/Dwg/del_dwg',array('id'=>$v['id']));?>'">删除</a> -->
				</td>
			</tr><?php endforeach; endif; ?>
	</tbody>
</table>
</div>
<!-- 确定图号模态框开始 -->
<div class="modal fade" id="prod-dwg" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		 <div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
					&times;
				</button>
				<h4 class="modal-title" id="myModalLabel">
					指定图号
				</h4>
			</div>
			<div class="modal-body">
				<form id="dwg-form" class="form-inline" action="<?php echo U('Depart/Prod/prod_dwg');?>" method="post">
					<input type="hidden" name="id">
					<table class="table table-striped table-bordered table-hover table-condensed">
						<tr>
							<th width="20%">产品编号：</th>
							<td>
								<input class="form-control" type="text" name="prodbatch">
							</td>
						</tr>
						<!-- <tr>
							<th>产品分类：</th>
							<td>
								<input class="form-control" type="text" name="type"> 
							</td>
						</tr> -->
						<tr>
							<th>图号：</th>
							<td>
								<input class="form-control" type="text" name="dwgcode"> 
							</td>
						</tr>
						<tr>
							<th></th>
							<td>
								<input class="btn btn-success" type="submit" value="修改">
							</td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</div>
</div>
<!-- 确认生产计划模态框结束 -->
<div class="modal fade" id="prod-plan" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		 <div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
					&times;
				</button>
				<h4 class="modal-title" id="myModalLabel">
					生产计划
				</h4>
			</div>
			<div class="modal-body">
				<form id="dwg-form" class="form-inline" action="<?php echo U('Depart/Prod/prod_plan');?>" method="post">
					<input type="hidden" name="id">
					<input type="hidden" name="item">
					<table class="table table-striped table-bordered table-hover table-condensed">
						<tr>
							<th width="20%">产品编号：</th>
							<td>
								<input class="form-control" type="text" name="prodbatch">
							</td>
						</tr>
						<tr>
							<th>请确认日期：</th>
							<td>
								<input type="text" class="datepicker form-control" placeholder="请选择日期" name="date"/>
							</td>
						</tr>
						<!-- <tr>
							<th>计划完工：</th>
							<td>
								<input type="text" class="datepicker form-control" placeholder="请选择日期" name="planednd"/> 
							</td>
						</tr> -->
						<tr>
							<th></th>
							<td>
								<input class="btn btn-success" type="submit" value="修改">
							</td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</div>
</div>
<!-- 确认生产计划模态框结束 -->

<script type="text/javascript">
	// 修改菜单
function edit(obj){
	var id=$(obj).attr('id');
	var prodbatch=$(obj).attr('prodbatch');
	var type=$(obj).attr('type');
	$("input[name='id']").val(id);
	$("input[name='prodbatch']").val(prodbatch);
	$("input[name='type']").val(type);
	$('#prod-dwg').modal('show');
}
	
function plan(obj){
	var id=$(obj).attr('id');
	var prodbatch=$(obj).attr('prodbatch');
	var item=$(obj).attr('item');
	$("input[name='id']").val(id);
	$("input[name='prodbatch']").val(prodbatch);
	$("input[name='item']").val(item);
	$('#prod-plan').modal('show');
}
</script>